package com.wzw.springboot.principle.expansion.event;

import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * 接收发布的事件
 *
 * @author Wangzhiwen
 */
@Component
public class PrincipleListener implements ApplicationListener<PrincipleEvent> {
    @Override
    public void onApplicationEvent(PrincipleEvent event) {
        String eventId = event.getEventId();
        // 执行逻辑
        System.out.println(eventId);
        System.out.println(event.getSource().toString());
    }
}
